//
//  SCMockDataHelper.m
//  SmartCommunityForFamilyTime
//
//  Created by Linyongzhi on 16/9/27.
//  Copyright © 2016年 UAMA. All rights reserved.
//

#import "SCMockDataHelper.h"

@implementation SCMockDataHelper

+ (NSDictionary *)loadJSONDataFromFile:(NSString *)fileName {
    NSString *strPath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"geojson"];
    NSError *error;
    NSData *data = [NSData dataWithContentsOfFile:strPath options:0 error:&error];
    
    if (error) {
        NSLog(@"Could not serialize GeoJSON file: %@", [error localizedDescription]);
        return nil;
    }
    
    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
    
    if (error) {
        NSLog(@"Could not serialize GeoJSON file: %@", [error localizedDescription]);
        return nil;
    }
    
    return json;
}

@end
